<!--
 * @Author: Aaron
 * @Date: 2022-01-26 10:52:00
 * @LastEditors: Aaron Huang
 * @LastEditTime: 2022-10-08 13:59:37
 * @Description: file content
 * @FilePath: \ias_ui\src\views\coi\spuManagement\components\seriesList.vue
 * @Company: 沃尔玛
-->
<template>
  <el-form ref="seriesFormRef" :model="formData" label-width="80px" :inline="true" size="mini" class="series">
    <slot name="header">
      <headline :headline="'商品系列'" />
    </slot>
    <ess-table
      :pagination-show="false"
      :count-height="false"
      size="mini"
      :thead-list="theadList"
      :data-list="list"
      :span-method="spanMethod"
      @handleSinkingAttribute="(_) => $emit('handleSinkingAttribute', _)"
    >
      <template v-slot:mainProduct="{ scope }">
        <el-form-item prop="mainSkuUpcNbr" class="main-radio">
          <input v-model="formData.mainSkuUpcNbr" class="main-product-radio" type="radio" name="upc" :disabled="disabled" :value="scope.row.upcNbr">
        </el-form-item>
      </template>
    </ess-table>
  </el-form>
</template>

<script>
import headline from '@/views/coi/components/headline.vue'
import essTable from '@/components/eTable/eTable.vue'
export default {
  name: 'SeriesList',
  components: {
    headline,
    essTable
  },
  props: {
    list: {
      type: Array,
      required: true
    },
    formData: {
      type: Object,
      default: () => {
        return {}
      }
    },
    theadList: {
      type: Array,
      required: true
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    spanMethod({ row, column, rowIndex, columnIndex }) {
      // console.log(row, column, rowIndex, columnIndex)
    },
    submitForm() {
      let flag = null
      this.$refs.seriesFormRef.validate((valid) => {
        flag = valid
      })
      return flag
    }
  }
}
</script>

<style lang="scss" scoped>
.table-pagination {
  padding: 0 10px;
  padding-top: 20px;
}
</style>
